/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Processing;

import java.security.MessageDigest;

/**
 *
 * @author Admin
 */
public class MD5Passing {

    public MD5Passing() {
    }


    public String makePass(String pass){
        try {
            StringBuffer s = new StringBuffer();
            byte[] data = pass.getBytes();

            MessageDigest md5 = MessageDigest.getInstance("MD5");
            md5.reset();
            md5.update(data);
            byte[] msgDigest = md5.digest();

            for (int i = 0; i < msgDigest.length; i++) {
                String hex = Integer.toHexString(0xff & msgDigest[i]);

                if (hex.length() == 1) {
                    s.append('0');
                }
                s.append(hex);
            }

            return s.toString();

        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
}
